namespace RStudio.Command
{
    /// <summary>
    /// 接口 | 命令项
    /// </summary>
    public interface ICommand
    {
        /// <summary>
        /// 命令名称
        /// </summary>
        string Name { get; }

        /// <summary>
        /// 描述项
        /// </summary>
        string Description { get; }

        /// <summary>
        /// 执行权限
        /// </summary>
        CommandPermission RequiredPermission { get; }


        /// <summary>
        /// 参数信息
        /// </summary>
        string[] ParamArray { get; }

        /// <summary>
        /// 使用示例
        /// </summary>
        string Usage { get; }    


        /// <summary>
        /// 检查执行者是否有足够权限
        /// </summary>
        bool HasPermission(CommandPermission userLevel)
        {
            return userLevel >= RequiredPermission;
        }

        /// <summary>
        /// 验证参数
        /// </summary>
        /// <param name="args">变量组</param>
        bool CanExecute(string[] args);

        /// <summary>
        /// 执行
        /// </summary>
        bool Execute(string[] args);
    }
}

